<?php
    $APIMaxPage = 100;
		//$AffiliateId = "084d9327.c3879663.084d9328.786af1a9";
		$AffiliateId = "0ec195ad.a2b066f5.0ec195ae.5de15934";
		$_developerId = array(
		'e70cba1682497894afbabaa850edc018',
		'3f6516745e90ae449eb0ef0c44413a49',
		'bf9f805d37fee51dff9577ac294e38a0',
	);
		$Version = "2010-08-05";
		$ItemUrl = "http://api.rakuten.co.jp/rws/3.0/json?";
		$ListUrl = $ItemUrl;
		
		$XmlOrJson = "JSON";
		$ListModel = array(
			"Available"	=> "count",//all count
			"item"		=> array(
								"Item=>{n}"	=> array(
										"site"		=> "rakuten",
										"title"		=> "itemName",
										"itemid"	=> "itemCode",
										"img"		=> "mediumImageUrl",
										"price"		=> "itemPrice",
										"bidorbuy"	=> "",
										"store"		=> "shopName",
										"NewItem"	=> "",
										"bids"		=> "",//auction
										"starttime"	=> "startTime",
										"endtime"	=> "",
										"timeleft"	=> ""
									)
							)
		);
		$ItemModel = array(
			"title"		=> "itemName",
			"itemid"	=> "itemCode",
			"img"		=> "mediumImageUrl",
			"url"		=> "affiliateUrl",
			"price"		=> "itemPrice",//現在価格です
			"quantity"	=> "",//商品の数量です。
			"bidorbuy"	=> "",//即決価格です
			"bids"		=> "",//現在の入札数です
			"condition"	=> "",//商品の状態です。
			"endtime"	=> "endTime",
			"remaintime"=> "",//残り時間
			"store"		=> "shopName",//有 StoreIcon :オークションストアの出品   无:一般の出品者の出品
			"postageFlag"		=> "postageFlag||catchcopy",//0：送料込   1：送料別&【送料無料】
			"taxFlag"		=> "taxFlag",//0：税込1：税別
			"itemCaption"		=> "itemCaption"//商品説明文
		);
		$Category = array(
			"All"			=>	"0",//所有
			"DesignerItems"=>	"216131",//ブランド|名牌|名牌|Designer Items
      "Watches"		=>	"216129",//钟表アクセサリー、時計
			"Shoes"			=>	"551177",//鞋
			"WomenShoes"	=>	"100371",//レディースファッション・靴|女性流行·鞋类
			"Food"			=>	"100227",//食品、飲料
			"Beverages"		=>	"100316",//水・ソフトドリンク|水·清凉饮料|水·清涼飲料
			"Ricewine"		=>	"510901",//日本酒・焼酎
			"Beer"			=>	"510915",//ビール・洋酒
			"Sweets" => "551167",//スイーツ|甜点|甜點|Sweets
			"HealthPersonalCare"	=>	"100938",//健康个人护理
			"Beauty"		=>	"100939",//美容ビューティー
			"Computer"		=>	"100026",//电脑
			"Cameras"		=>	"211742",//AV、カメラ
			"HomeImprovement"		=>	"100804",//家居改善住まい、インテリア
			"Lawn"			=>	"100005",//花、園芸
			"Grocery"		=>	"215783",// キッチン、生活雑貨、日用品
			"Pets"			=>	"101213",//ペット、生き物
			"DVD"			=>	"101240",//DVD
			"Toys"			=>	"101164",//玩具おもちゃ、ゲーム
			"Outdoors"		=>	"101070",//Outdoors 休闲レジャー、アウトドア
			"Automotive"	=>	"101114",//汽车
			"Music"			=>	"101240",//音乐
			"Books"			=>	"200162",//书籍
			"Tickets"		=>	"101381",//チケット、金券、宿泊予約計
			"RealEstate"	=>	"200163",
			"Study"			=>	"101438",//学び・サービス・保険
			
			"Electronics"	=>	"402853",//电子 家電、AV、カメラ
			"Underwear"		=>	"100433",//インナー・下着・ナイトウエ|内衣·睡衣
			"MedicineCabinet"		=>	"551169",//医薬品・コンタクト・介護
			"MusicalInstruments"	=>	"101240",//乐器
			//'29'=>array('id'=>'100000','name'=>'百貨店・総合通販・ギフト|百商店·综合邮购·礼物|百商店·綜合郵購·禮物|Department,NetShopping & Gift'),
			//'30'=>array('id'=>'402853','name'=>'デジタルコンテンツ|数码产品數碼產品|DigitalContents'),
			//"Baby"			=>	"100533",//宝贝
			//"SportingGoods"	=>	"551167",//体育用品
			//"Golf"			=>	"101077",//ゴルフ
			//"AutomobileSupplies"	=>	"503190",//車用品・バイク用品
		);
		$SortOrder = array(
			"end,A"		=>	"-updateTimestamp",//high to low
			"end,D"		=>	"+updateTimestamp",
			"price,A"	=>	"-itemPrice",//high to low
			"price,D"	=>	"+itemPrice",
			"bids,A"		=>	"-reviewCount",//high to low
			"bids,D"		=>	"+reviewCount"
		);

		//http://webservice.rakuten.co.jp/api/itemcodesearch/
		$ItemParam = array(
			//"developerId"	=> $Appid,
			"developerId"	=> $_developerId[rand(0,count($_developerId)-1)],
			"affiliateId"	=> $AffiliateId,
			"operation"	 	=> "ItemCodeSearch",
			"callBack"		=> "",
			"itemCode"		=> _GET("itemid"),
			"version"		=> $Version,
			"carrier"		=> ""
		);
		
		$oldsearchcate = checknull("id", checknull(_GET("c"), $SiteCate["shopping"]["rakuten"]));
		$allsearchcate = checknull("rakuten", checknull(_GET("c"), $SiteCate["shopping"]["all"]));
		//http://webservice.rakuten.co.jp/api/itemsearch/
		$ListParam = array(
			"developerId"	=> $_developerId[rand(0,count($_developerId)-1)],
			"affiliateId"	=> $AffiliateId,
			"operation"	 	=> "ItemSearch",
			"callBack"		=> "",
			"keyword"		=> $keyword,
			"version"		=> $Version,
			"shopCode"		=> "",
			"genreId"		=> "",
			//"catalogCode"	=> empty($oldsearchcate )?"0":$oldsearchcate ,
			//"catalogCode_all"    => empty($allsearchcate )?"0":$allsearchcate ,
			"genreId"	=> empty($oldsearchcate )?"0":$oldsearchcate ,
			"genreId_all"    => empty($allsearchcate )?"0":$allsearchcate ,
			"hits"			=> "30",
			"page"			=> $pagenum,
			//"sort"			=> empty($_GET["s"])?"":$SortOrder[$_GET["s"]],
			"sort"			=> checknull(_GET("s"), $SortOrder),
			"minPrice"		=> _GET("Minprice"),
			"maxPrice"		=> _GET("Maxprice"),
			//0：すべての商品  1：販売可能な商品のみ
			"availability"	=> "1",
			/**
			0：検索対象が広い（同じ検索キーワードでも多くの検索結果が得られる）
1：検索対象範囲が限定される（同じ検索キーワードでも少ない検索結果が得られる）
			*/
			"field"			=> "0",
			"carrier"		=> "",
			"imageFlag"		=> "",
			"orFlag"		=> "",
			"NGKeyword"		=> "",
			"genreInformationFlag"	=> "",
			"purchaseType"			=> "",
			"shipOverseasFlag"		=> "",
			"shipOverseasArea"		=> "",
			"asurakuFlag"			=> "",
			"asurakuArea"			=> ""
		);
?>